<?php
//抛出和捕获异常
//抛出异常
$param = isset($_REQUEST['param']) ? $_REQUEST['param']: null;
function throws($param) {
    if (!is_array($param)) {
        throw new Exception("audience's args must be a array");
    }
}

//throws($param);

//捕获异常
try {
    $error = 'Always throw this error';
    throw new InvalidArgumentException($error);

    // Code following an exception is not executed.
    echo 'Never executed';

} catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}
